import { fetch, oss } from '@/utils/fetch.js';

// 获取订单列表
export function getOrderList(params) {
  return fetch({
    url: '/questionlib/nice/order/list',
    method: 'POST',
    data: params,
  });
}

// 订单总额
export function orderTotal(params) {
  return fetch({
    url: '/questionlib/nice/order/total',
    method: 'POST',
    data: params,
  });
}

// 退款
export function refund(params) {
  return fetch({
    url: '/questionlib/pay/union/refund',
    method: 'POST',
    data: params,
  });
}

// 活动优惠券详情
export function activityCouponDetails(params) {
  return fetch({
    url: '/usercenter/operation/order/activityCouponDetails',
    method: 'POST',
    data: params,
  });
}
// 活动详情
export function activityDetails(params) {
  return fetch({
    url: '/usercenter/operation/order/activityDetails',
    method: 'POST',
    data: params,
  });
}

// 虚拟商品订单详情
export function virtualGoodsDetails(params) {
  return fetch({
    url: '/usercenter/operation/order/virtualGoodsDetails',
    method: 'POST',
    data: params,
  });
}

// 订单列表(含搜素)
export function getIntegralOrderList(params) {
  let arg = {
    startTime: params.startTime,
    endTime: params.endTime,
    orderId: params.orderId,
    orderStatus: params.orderStatus,
    accountName: params.accountName,
    accountPhone: params.accountPhone,
    goodsName: params.goodsName,
  };
  return fetch({
    url: `/nice/order/physical/goods/list/${params.pageNum}/${params.size}`,
    method: 'POST',
    data: arg,
  });
}

// 订单详情
export function getIntegralOrderDetails(params) {
  return fetch({
    url: `/nice/order/physical/order/detail/${params.order_number}`,
    method: 'GET',
    // data: {}
  });
}

// 个人订单
export function getStudentOrderList(params) {
  return fetch({
    url: `/nice/order/physical/goods/user/list/${params.id}/${params.pageIndex}/${params.pageSize}`,
    method: 'GET',
    // data: {}
  });
}

//订单数据导出
export function exportOrderList(params) {
  return fetch({
    url: '/questionlib/nice/order/physical/order/logistics/export',
    method: 'POST',
    data: params,
    responseType: 'blob',
  });
}

//物流信息导入
// export function importOrderList(params,type) {
//   return oss({
//     baseUrl: '/nice/order/physical/order/logistics/import',
//     method: 'POST',
//     data: params,
//     type:type
//   })
// }
export function importOrderList(params, type) {
  return oss({
    baseUrl: '/nice/order/physical/order/logistics/import',
    method: 'POST',
    data: params,
    type: type,
  });
}

//物流公司修改
export function editlogisticCompany(params) {
  return fetch({
    url: '/questionlib/nice/order/physical/goods/logistics/company/edit',
    method: 'POST',
    data: params,
  });
}

//物流单号修改
export function editlogisticNumber(params) {
  return fetch({
    url: '/questionlib/nice/order/physical/goods/logistics/no/edit',
    method: 'POST',
    data: params,
  });
}
